<template>
  <el-container class="bg-white rounded" style="height: calc(100vh - 148px);">
    <el-header class="image-header">
      <el-button type="primary" size="small" @click="handleOpenCreate">新增图片分类</el-button>
      <el-button type="warning" size="small" @click="handleOpenUpload">上传图片</el-button>
    </el-header>
    <el-container>
      <ImageAside ref="ImageAsideRef" @change="handleAsideChange" />
      <ImageMain ref="ImageMainRef" />
    </el-container>
  </el-container>
</template>
<script lang="ts">
import { ref, defineComponent } from "vue"
import ImageAside from "@/components/imageComp/ImageAside.vue"
import ImageMain from '@/components/imageComp/ImageMain.vue'

export default defineComponent({
  components: { ImageAside, ImageMain },
  setup() {

    const ImageAsideRef = ref(null)
    const handleOpenCreate = () => ImageAsideRef.value?.handleCreate()

    const ImageMainRef = ref(null)
    const handleAsideChange = (image_class_id) => ImageMainRef.value?.loadData(image_class_id)

    const handleOpenUpload = () => ImageMainRef.value?.openUploadFile()
    return {
      ImageAsideRef,
      handleOpenCreate,
      ImageMainRef,
      handleAsideChange,
      handleOpenUpload
    }
  }
})
</script>
<style>
.image-header {
  border-bottom: 1px solid #eeeeee;
  @apply flex items-center;
}
</style>